<!-- Sidebar display for each respective sport -->
<span style="font-style:italic;font-size:10px;">Filter:</span>
<ul></ul>

<% 
  sport = sport_side if local_assigns.has_key?(:sport_side)
  leagues_with_country = sport.leagues.all(:conditions=>"country_id IS NOT NULL")
  leagues = []
  leagues_with_country.each do |l|
    leagues[l.country_id] ||= []
    leagues[l.country_id] << l
  end
  leagues_without_country = sport.leagues.all(:conditions=>"country_id IS NULL")
%>

<table class='filter'>
	<tr>
		<td <%= params[:order_by] == "most_popular" ? "class='selected'" : '' %>>
			<%= link_to "Most Popular",:order_by=>"most_popular" %>
		</td>
              </tr>
	<tr>
		<td <%= params[:order_by] == "most_bets" ? "class='selected'" : '' %>>
			<%= link_to "Most Bets",:order_by=>"most_bets" %>
		</td>
	</tr>

	<tr>
		<td <%= params[:order_by] == "comment_count" ? "class='selected'" : '' %>>
			<%= link_to "Most Comments",:order_by=>"comment_count" %>
		</td>
	</tr>
	<tr>
		<td <%= @league.nil? && params[:order_by].nil? ? "class='selected'" : '' %>>
			<%= link_to "Most Recent",sport_path(@sport) %>
		</td>
	</tr>

	<% Country.all.each do |country| %>
	<% next if leagues[country.id].blank? %>
		<tr>
			<td style="padding:0px">
				<hr width="100%" size="0.5px" color="#D8DFEA">
			</td>
		</tr>
		<tr>
			<td><%= country.name %></td>
		</tr>
		<tr>
			<td><%= render :partial=>"leagues/league",:collection=>leagues[country.id] %></td>
		</tr>
	<% end %>
	
	<tr>
		<td><%= render :partial=>"leagues/league",:collection=>leagues_without_country %></td>
	</tr>
</table>

<table class='key' style="margin-top:10px;">
	<tr><td>
		<span style="font-style:italic;font-size:10px;">Use:</span>
	</tr></td>
	<tr><td>
		50 WinPoints per bet
	</tr></td>
	<tr><td><center><hr width="100%" size="0.5px" color="#D8DFEA"></center></td></tr>
	<tr><td>
		<span style="font-style:italic;font-size:10px;">Bet:</span>
	</tr></td>
	<tr><td>
		1-500 WinPoints against each friend 
	</tr></td>
	<tr><td><center><hr width="100%" size="0.5px" color="#D8DFEA"></center></td></tr>
	<tr><td>
		<span style="font-style:italic;font-size:10px;">Earn:</span>
	</tr></td>
	<tr><td>
		50 WinPoints per sent invite
	</tr></td>
	<tr><td>
		450 WinPoints per accepted invite
	</tr></td>
	<tr><td>
		5 WinPoints per comment
	</tr></td>
</table>
